<template>
	<view class="list" v-if="noNull(list)">
		<view class="">

		</view>
		<u-loadmore height="40" fontSize="13" :status="more.moreType" v-if="more.moreShow" />
	</view>
	<Kong v-else />
</template>

<script setup>
	import { noNull } from "../common/func.js"
	import { onReachBottom } from "@dcloudio/uni-app"
	import apis from "@/apis"
	import { ref, reactive, watch, onMounted } from 'vue'

	// let props = defineProps({})
	// const emit = defineEmits(['change'])

	let list = reactive([])
	let recordTotal = ref(0)
	let more = reactive({
		moreType: "more",
		moreShow: false,
	})
	let pagination = reactive({
		page: 1,
		pageSize: 20
	})

	const getList = (type) => {
		if (type) {
			pagination.page = 1
			more.moreShow = false
			list = []
		};
		// apis['']({
		// 	...pagination
		// }).then(res => {
		// 	recordTotal.value = res.pagination.recordTotal
		// 	if (res.pagination.recordTotal == list.length) {
		// 		more.moreType.value = "nomore"
		// 	} else {
		// 		list = [...list, ...res.list]
		// 		more.moreType = "more"
		// 	}
		// 	uni.stopPullDownRefresh()
		// })
	}

	onMounted(() => {
		getList()
	})
	onReachBottom(() => {
		more.moreType = 'loading'
		more.moreShow = true;
		pagination.page += 1
		getList()
	})
	defineExpose({
		list,
		getList
	})
</script>
<style lang="scss" scoped>
	.list {
		>view {
			height: 600rpx;
			border: 1rpx solid red;
		}
	}
</style>
